﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using FwProject.Controllers;
using FwProject.ManagerConfig;
using FwProject.ManagerConfig.Dto;
using Microsoft.AspNetCore.Mvc;

namespace FwProject.Web.Controllers
{
    public class MConfigController: FwProjectControllerBase
    {
        private readonly IConfigInfoAppService _configInfoAppService;

        public MConfigController(IConfigInfoAppService configInfoAppService)
        {
            _configInfoAppService = configInfoAppService;
        }

        public async Task<IActionResult> Index()
        {
            var model = await _configInfoAppService.GetListAsync();
            return View(model);
        }

        public async Task<IActionResult> Save(ConfigInfoInput input)
        {
            var id = await _configInfoAppService.Create(input);
            return Json(id);
        }

        public async Task<IActionResult> Update(Guid id,ConfigInfoInput input)
        {
            await _configInfoAppService.Update(id,input); ;
            return Json(id);
        }
    }
}
